package com.nowcoder.community.controller;

import com.nowcoder.community.entity.User;
import com.nowcoder.community.service.AlphaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Controller
//@RestController
public class AlphaController {
    @Autowired
    private AlphaService alphaService;

    @RequestMapping(path = "/find", method = RequestMethod.GET)
    @ResponseBody
    public String find() {
        List<User> users = alphaService.findAllUsers();
        StringBuilder sb = new StringBuilder();
        for (User user : users) {
            sb.append(user.toString());
        }
        return sb.toString();
    }

}
